home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: a1s@ix.netcom.com (Andrew Snyder)
- Newsgroups: comp.lang.c
- Subject: Re: Checking for a file => Does it exist (Help)
- Date: Wed, 17 Jan 1996 19:04:00 GMT
- Organization: Netcom
- Message-ID: <4dj6pm$dbg@ixnews6.ix.netcom.com>
- References: <4d9k6fINNnja@faatcrl.faa.gov>
- NNTP-Posting-Host: ix-har5-17.ix.netcom.com
- X-NETCOM-Date: Wed Jan 17 8:06:14 AM PST 1996
- X-Newsreader: Forte Free Agent 1.0.82
-
- afrawert@faatcrl.faa.gov (Alan Frawert) wrote:
-
-
-
- > I'm having a problem just checking to see if a file
- >exists. Does anyone have a simple piece of code that I can use?
-
- > afrawert@faatcrl.faa.gov
-
- This is a job for a system dependent function, since files are system
- dependent things. Some people have suggested the fopen trick, which
- doesn't work for two reasons:
-
- 1. you can be out of file handles.
- 2. the file might exist, but you might not have permissions to read
- it.
-
- All of the systems I know about have a function called access that can
- be used to see if a file exists, is readable, and/or is writable.
- Your system must have something like it, although it might not be
- called access.
-
- If you want to write portable code, write a function wrapper in a
- seperate file and put the prototype in a header file somewhere.
-
-
- Andrew Snyder
- a1s@ix.netcom.com
- char disclaimer[] = {'\0'}; /* I'm on cash net */
-
-